package com.example.mq.demotopic;

import com.example.mq.mqclient.Channel;
import com.example.mq.mqclient.Connection;
import com.example.mq.mqclient.ConnectionFactory;
import com.example.mq.mqserver.core.ExchangeType;

import java.io.IOException;

public class Init {
    public static void main(String[] args) throws IOException {
        ConnectionFactory connectionFactory = new ConnectionFactory();
        connectionFactory.setHost("127.0.0.1");
        connectionFactory.setPort(9090);

        Connection connection = connectionFactory.getNewConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare("exchange1", ExchangeType.TOPIC,true,false,null);
        channel.queueDeclare("queue1",true,false,true,null);
        channel.queueDeclare("queue2",true,false,true,null);
        channel.queueDeclare("queue3",true,false,true,null);
        channel.queueBind("queue1","exchange1","*.*.aaa");
        channel.queueBind("queue2","exchange1","bbb.*");
        channel.queueBind("queue3","exchange1","#.ccc");
    }
}
